<h1>Pick a volume/issue</h1>

<%if flash[:redrover_notice]%>
    <p class="info" >
        <%=flash[:redrover_notice]%>
    </p>
<%end%>

<%#FIXME: Move the query to the controller%>

<%for volume in @volumes %>

  <%vol = volume %>

  <%@update_id= "issues_in_volume_#{vol.id}"%>
  
  <div>
  <h3>Volume <%= vol.volume_number %> (<%= vol.issues.count %> issues)</h3>
  
  <%=collapsable_panel(self.render(:partial => "new_issue_panel", 
                                   :locals=>{:update_id=>@update_id, :volume=>vol} ),'Create a new issue',"create_issue_panel_#{vol.id}", "display:none")%>
  
  <%#TODO: Move this query to the controller
  %>
  <%@issues = Issue.find_by_volume(vol.id)%>
    
      <div id="<%=@update_id%>">
        <table>
      
        <%= render(:partial => 'issues', :collection=>@issues)%> 
      
        </table> 
      </div>

    </div>  
 
<%end%>

